import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../components/Home.vue'
import Welcome from '../components/Welcome.vue'
import Login from '../components/Login.vue'

// 定义路由规则
const routes = [{
    path: '/',
    component: Home,
    name: 'home',
    redirect: '/welcome',
    children: [{
            path: '/welcome',
            meta: {
                title: 'welcome页'
            },
            component: Welcome,
            name: 'welcome',
        },
        {
            path: '/login',
            component: Login,
            meta: {
                title: 'login页'
            },
            name: 'login',
        }
    ]
}]

// 创建路由实例
const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router